﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WPF基础.控件
{
    /// <summary>
    /// A06_CheckBox.xaml 的交互逻辑
    /// </summary>
    public partial class A06_CheckBox : Window
    {
        public A06_CheckBox()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            UIElementCollection Children = G1.Children;
            StringBuilder Subject = new StringBuilder("我的选课为");
            foreach(UIElement item in Children)
            {
                if(item is CheckBox && (item as CheckBox).IsChecked.Value)
                {
                    Subject.Append((item as CheckBox).Content);
                }
            }
            MessageBox.Show(Subject.ToString());

        }
    }
}
